﻿<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=GBK" />
</head>
<body>
	
<h3>110323-YK-接收提交借阅请求表单</h3>
<?php
/**********************************
*110323-YK-接收提交借阅请求表单
*
*
*
***********************************/
include_once("./dag_functions/class_core.php");
$form_jyqq_user_dep= $_POST['form_jyqq_user_dep'];
$form_jyqq_file_id= $_POST['form_jyqq_file_id'];
$form_jyqq_user_id= $_POST['form_jyqq_user_id'];
$form_jyqq_reason= $_POST['form_jyqq_reason'];
$form_jyqq_time_end= $_POST['form_jyqq_time'];
$form_jyqq_time= date("Y-m-d");
//先判断是否已经借阅
$result = DB::fetch_first("SELECT count(*) as num FROM tab_jyqq WHERE jyqq_user_id='".$form_jyqq_user_id."' AND jyqq_file_id='".$form_jyqq_file_id."'");
//echo $file_id;
if ($result['num'] >= 1)
	{
		echo "你已经借阅了此档案，请等待管理员审核";
		?>
				<script language="javascript" type="text/javascript">
		           alert("你已经借阅了此档案，请等待管理员审核！");
		           window.location.href="index.php"; 
				</script>
		<?php
		
	}
else
{
	$query=DB::query("insert into tab_jyqq (jyqq_user_id,jyqq_dep,jyqq_file_id,jyqq_reason,jyqq_time,jyqq_time_end)VALUES('".$form_jyqq_user_id."','".$form_jyqq_user_dep."','".$form_jyqq_file_id."','".$form_jyqq_reason."','".$form_jyqq_time."','".$form_jyqq_time_end."')");
	
	echo "已提交借阅请求，请等待管理员审核";
	?>
					<script language="javascript" type="text/javascript">
		           alert("已提交借阅请求，请等待管理员审核！");
		           window.location.href="index.php"; 
					</script>
	
	<?php
}

?>

</body>
</html>